import { createRouter, createWebHistory } from 'vue-router'
import HomeView from '../views/HomeView.vue'

const routes = [
  {
    path: '/',
    name: 'home',
    component: HomeView,
    redirect:'/Login',
    children:[
      {path: '/article', component: () => import('@/views/community/ArticleView.vue')},
      {path: '/index', component: () => import('@/views/community/indexView.vue')},
      {path: '/community', component: () => import('@/views/community/CommunityView.vue')},
      {path: '/my-articles', component: () => import('@/views/community/MyArticlesView.vue')},
      {path: '/createArticle', component: () => import('@/views/community/CreateArticleView.vue')},
      {path: '/shop', component: () => import('@/views/shop/ShopView.vue')},
      {path: '/shopDetail', component: () => import('@/views/shop/ShopDetailView.vue')},
      {path: '/product', component: () => import('@/views/shop/ProductDetailsView.vue')},
      {path: '/userMessage', component: () => import('@/views/user/UserMessageView.vue')},
      {path: '/order', component: () => import('@/views/order/OrderView.vue')},
      {path: '/orderDetail', component: () => import('@/views/order/OrderDetailView.vue')},
      {path: '/orderDetails', component: () => import('@/views/shop/OrderDetailsView.vue')},
    ]
  },
  {path: '/login', component: () => import('../views/LoginView')},
  {path: '/user', component: () => import('../views/user/UserView.vue')},
  {path: '/cart', component: () => import('../views/shop/CartView.vue')},
  {path: '/addresses', component: () => import('../views/user/AddressesView.vue')},


]

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes
})

export default router